/*-------------------------------------------------------------------------
 * CLR版本:     4.0.30319.42000
 * 创建人:      song
 * 创建时间：   2024/4/9 17:56:20
 * 功 能：      消融模块
 *-------------------------------------------------------------------------*/

#if UNITY_EDITOR
namespace SCore.Editor.SShaderDraw
{
    using System.Collections.Generic;
    using UnityEditor;
    using UnityEngine;

    public class SDisloveProGUI : SComponentGUIBase
    {
        SKeyWordProp _Disolve;
        STextureProp _DisolveTex;
        SRangeProp _DisloveAmount;
        SColorProp _DisloveRimStartColor, _DisloveRimEndColor;
        SFloatProp _DisloveRimColorLengt;

        public SDisloveProGUI(MaterialEditor materialEditor, Dictionary<string, MaterialProperty> dics) : base(
            materialEditor, dics)
        {
            _Disolve = new SKeyWordProp("_Disolve", Styles.Disolve, materialEditor, dics, 0f, true,
                SShaderEditorHelpr.GetInternelStyle("BoldTextField"));
            _DisolveTex = new STextureProp("_DisolveTex", Styles.DisolveTex, materialEditor, dics, null);
            _DisloveAmount = new SRangeProp("_DisloveAmount", Styles.DisloveAmount, materialEditor, dics, 0f, 0f, 1f);
            _DisloveRimStartColor = new SColorProp("_DisloveRimStartColor", Styles.DisloveRimStartColor, materialEditor,
                dics, Color.white);
            _DisloveRimEndColor = new SColorProp("_DisloveRimEndColor", Styles.DisloveRimEndColor, materialEditor, dics,
                Color.white);
            _DisloveRimColorLengt = new SFloatProp("_DisloveRimColorLengt", Styles.DisloveRimEndColor, materialEditor,
                dics, 0.6f);
        }

        public override void Changed()
        {
        }

        public override void DrawProperties()
        {
            if (_Disolve.Exist)
            {
                GUILayout.BeginVertical("box");
                base.DrawPartTitle(_Disolve, Styles.Disolve, 15f, this.lProps.ToArray());
                GUILayout.EndVertical();
            }
        }

        public override void RefreshProperties()
        {
            this.lProps.Clear();
            this.lProps.Add(_DisolveTex);
            this.lProps.Add(_DisloveAmount);
            this.lProps.Add(_DisloveRimStartColor);
            this.lProps.Add(_DisloveRimEndColor);
            this.lProps.Add(_DisloveRimColorLengt);
        }

        private class Styles
        {
            public static GUIContent Disolve = new GUIContent("消融", "消融");
            public static GUIContent DisolveTex = new GUIContent("消融噪音纹理", "消融噪音纹理");
            public static GUIContent DisloveAmount = new GUIContent("消融进度", "消融进度");
            public static GUIContent DisloveRimColorLengt = new GUIContent("消融阈值", "消融阈值");
            public static GUIContent DisloveRimStartColor = new GUIContent("消融边缘阈值前颜色", "消融边缘阈值前颜色");
            public static GUIContent DisloveRimEndColor = new GUIContent("消融边缘阈值后颜色", "消融边缘阈值后颜色");
        }
    }
}
#endif